<template lang="pug">
  li.ctxtmenu(@click="handleClick") {{label}}
</template>
<script>
export default {
  name: 'MenuItem',
  props: {
    label: {
      type: String,
      default: '提交'
    },
    funcProps: {
      type: Object,
      default: () => ({})
    }, // 其他组件传给按钮的参数，供按钮事件执行时调用
    func: Function // 按钮事件，按钮点击或其他方式触发时执行
  },
  data () {
    return {
    }
  },
  methods: {
    handleClick () {
      this.func({
        funcProps: {
          button: this,
          ...this.funcProps
        }
      })
    }
  }
}
</script>

<style lang="sass" scoped>
.ctxtmenu
  width: 100%
  padding: 10px
  box-sizing: border-box
  background: #fff
  cursor: pointer
  &:hover
    background: #e5e5e5
</style>
